using System;
using System.Windows.Data;

namespace FluentSilverlight.Expressions
{
    public class BindModeExpression<TParentPart>
    {
        private readonly TParentPart parentPart;
        private readonly Action<BindingMode> setValue;

        public BindModeExpression(TParentPart parentPart, Action<BindingMode> setValue)
        {
            this.parentPart = parentPart;
            this.setValue = setValue;
        }

        public TParentPart OneWay()
        {
            setValue(BindingMode.OneWay);
            return parentPart;
        }

        public TParentPart OneTime()
        {
            setValue(BindingMode.OneTime);
            return parentPart;
        }

        public TParentPart TwoWay()
        {
            setValue(BindingMode.TwoWay);
            return parentPart;
        }
    }
}